﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace MostDrive
{
    class Score
    {
        public int GetMaxScore()
        {
            try
            {
                if (File.Exists("file.txt"))
                {
                    int score = 0;
                    using (var reader = new StreamReader("file.txt"))
                    {
                        score = Convert.ToInt32(reader.ReadLine());
                    }

                    return score;
                }
            }
            catch (Exception)
            {
                //log
            }

            return 0;
        }

        public void SetScore(int score)
        {
            try
            {
                using (var writer = new StreamWriter("file.txt"))
                {
                    writer.WriteLine(score);
                }
            }
            catch (Exception)
            {
                //log
            }
        }
    }
}
